package com.honey.sql92script.schema;

import java.util.HashMap;
import java.util.Map;

import com.honey.core.dbmapping.structure.StructureType;
import com.honey.core.dbmapping.structure.Table;
import com.honey.core.types.Vendor;
import com.honey.core.utils.ObjectDump;

/**
 * 数据库表结构
 * @author Administrator
 *
 */
public class SqlScriptTable implements Table{
	
	/** 表所在的schema */
	private String schema;
	
	/** 表名称 */
	private String name;
	
	/** 表的别名 */
	private String alias;

	/** 表的注释 */
	private String comment;
	
	/** 数据库名称 */
	private Vendor vendor;
	
	/** 建库脚本 */
	private String sqlScipt ;
	
	/** 更多其它信息(如果可以获取) */
	private Map<String , String> moreInformation = new HashMap<String, String>();
	
	@Override
	public String getAlias() {
		
		return this.alias;
	}

	@Override
	public String getCatalog() {

		return null;
	}

	@Override
	public String getComment() {
		
		return this.comment;
	}

	@Override
	public Map<String, String> getMoreInformation() {
		
		return this.moreInformation;
	}

	@Override
	public String getSchema() {
		
		return this.schema;
	}

	@Override
	public String getSqlScipt() {
		
		return this.sqlScipt;
	}

	@Override
	public String getName(){
		
		return this.name;
	}

	@Override
	public Vendor getVendor() {
		
		return this.vendor;
	}
	
	public void addInformation(String key ,String value){
		this.moreInformation.put(key, value);
	}

	public void setSchema(String schema) {
		this.schema = schema;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public void setVendor(Vendor vendor) {
		this.vendor = vendor;
	}

	public void setSqlScipt(String sqlScipt) {
		this.sqlScipt = sqlScipt;
	}
	
	public void setMoreInformation(Map<String, String> moreInformation) {
		this.moreInformation = moreInformation;
	}

	@Override
	public StructureType getSchemaType() {
		return StructureType.TABLE;
	}

	@Override
	public String toString() {
        return ObjectDump.dump(this);
    }
	
}
